package tools.genomeMatrix;

public class genomeGap {

	private int strain,start, end;
	
	public genomeGap(int strain, int start, int end) {
		super();
		this.strain = strain;
		this.start = start;
		this.end = end;
	}
	
	public genomeGap(genomeGap gg){
		this(gg.getStrain(),gg.getStart(),gg.getEnd());
	}
	
	public boolean overlap(genomeGap gg){
		return (this.getEnd()>gg.getStart()&&this.getEnd()<=gg.getEnd())||(gg.getEnd()>this.getStart()&&gg.getEnd()<=this.getEnd());
	}
	
	public void extend(genomeGap gg){
		if(gg.getStart()<this.getStart()){
			this.setStart(gg.getStart());
		}
		if(gg.getEnd()>this.getEnd()){
			this.setEnd(gg.getEnd());
		}
	}
	
	public int getLength() {
		return this.getEnd()-this.getStart();
	}

	public int getStrain() {
		return strain;
	}

	public void setStrain(int strain) {
		this.strain = strain;
	}

	public int getStart() {
		return start;
	}

	public void setStart(int start) {
		this.start = start;
	}

	public int getEnd() {
		return end;
	}

	public void setEnd(int end) {
		this.end = end;
	}
	
	
}
